<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/6/5
 * Time: 18:57
 */
include "config.php";
if ($_SERVER["REQUEST_METHOD"]=="POST"){

    if (!empty($_REQUEST["uname"])&&!empty($_REQUEST["upwd"])&&!empty($_REQUEST["utel"])){
        $registerSQL="INSERT INTO userinfo (u_name,u_pwd,u_tel) VALUES(?,?,?)";
        $stmt=$conn->prepare($registerSQL);

        $stmt->bind_param("sss",$_REQUEST["uname"],$_REQUEST["upwd"],$_REQUEST["utel"]);
        $stmt->execute();
        if ($stmt->affected_rows>=1){
            print_r(json_encode(Array("status"=>1,"msg"=>"注册成功")));
        }else{
            print_r(json_encode(Array("status"=>0,"msg"=>"注册失败")));
        }
    }else{
        print_r(json_encode(Array("status"=>0,"msg"=>"参数不正确")));
    }
}else{
    print_r(json_encode(Array("status"=>0,"msg"=>"请使用post请求")));
}